﻿using ApplicationModels.A04.Interactions;
using AutoMapper;
using Commons.Responses;
using EntityModels.E04.Interactions;
using IApplicationServices;
using IRepositories;
using System.Linq.Expressions;

namespace ApplicationService
{
    public class StarItemService:BaseApplicationService<int,StarItem,StarItemAM>,IStarItemService
    {
        public StarItemService(IBaseRepository<int,StarItem> repository,IMapper mapper):base(repository,mapper) { }

        public override async Task<DatasResponse<StarItemAM>> GetAllAsync(Expression<Func<StarItem, bool>> predicate)
        {
            var bos = await Repository.GetAllAsync(predicate,new Dictionary<string, bool> { { "UpdateTime",true} });
            var apibos = Mapper.Map<List<StarItemAM>>(bos.Datas);
            return new DatasResponse<StarItemAM>(bos.Total, apibos);
        }
    }
}
